/*
 * @(#)CityServiceImp.java
 * Copyright (c) 2011 TravelSky Technology Ltd. All Right Reserved. 
 */
package com.meetingshow.meeting.service;

import java.util.ArrayList;
import java.util.List;    
    
import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseServiceImp;
import com.meetingshow.common.base.service.model.QueryResults;
import com.meetingshow.meeting.dao.CityDAO;
import com.meetingshow.meeting.dao.model.CityPO;
import com.meetingshow.meeting.service.model.CityQueryParas;
import com.meetingshow.meeting.service.util.CityQueryParasBuilder;
import com.meetingshow.meeting.service.util.CityServiceParas;

public class CityServiceImp extends BaseServiceImp implements ICityService {

    private CityDAO cityDAO;
    
    public CityDAO getCityDAO() {
        return cityDAO;
    }

    public void setCityDAO(CityDAO cityDAO) {
        this.cityDAO = cityDAO;
    }
    
    @Override
    public CityPO getCityById (java.lang.Integer cityId) throws Exception {
        return getCityDAO().getCityById(cityId);
    }
    
    @Override
    public QueryResults<CityPO> queryCity(CityQueryParas cityQueryParas)
            throws Exception {
        QueryStruct queryStruct = new QueryStruct();
        List<String> tableList = new ArrayList<String>();
        List<String> returnObjectList = new ArrayList<String>();
        
        tableList.add(CityServiceParas.CITYPO);
        returnObjectList.add(CityServiceParas.CITYPO);
        
        queryStruct.setTableList(tableList);
        queryStruct.setReturnObjectList(returnObjectList);
        
        queryStruct = CityQueryParasBuilder.cityQueryBuilder(queryStruct, cityQueryParas);
        QueryResults<CityPO> queryResults = getCityDAO().queryCity(queryStruct);
        return queryResults;
    }

    @Override
    public void removeCity(CityPO cityPO) throws Exception {
        getCityDAO().removeCity(cityPO);
    }

    @Override
    public void saveCity(CityPO cityPO) throws Exception {
        getCityDAO().saveCity(cityPO);
    }

    @Override
    public void updateCity(CityPO cityPO) throws Exception {
        getCityDAO().updateCity(cityPO);
    }

}